package bold.redisson;

import lombok.Data;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LockController {

    @RequestMapping("lock1")
    @Lock(prefix = "name")
    public Object lock1(String name) {
        System.out.println("获取锁=" + name);
        return "ok";
    }

    @RequestMapping("lock2")
    @Lock(prefix = "name",field = "id")
    public Object lock2(Req req) {
        System.out.println("获取锁=" + req.id);
        return "ok";
    }


    @Data
    private static class Req {
        private String name;
        private String id;
    }
}
